package com.jk.scheduler;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

@Component
@Slf4j
public class SchedulerTask {

    private int count = 0;

    private static final SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");

    /**
     *  * * * * * ?
     *  秒 分 时 天 月 星期  年
     */
//    @Scheduled(cron = "*/6 * * * * ?")
    public void process() {
        log.info("his is scheduler task runing : "  + (count++));
    }

//    @Scheduled(fixedRate = 6000)
    public void reportCurrentTime() {
        log.info("现在时间是：" + sdf.format(new Date()));
    }

}
